<!DOCTYPE html>
<html>
<head>
    <!-- 页面meta -->
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>传智健康</title>
    <meta name="description" content="传智健康">
    <meta name="keywords" content="传智健康">
    <meta content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=no" name="viewport">
    <!-- 引入样式 -->
    <link rel="stylesheet" href="../plugins/elementui/index.css">
    <link rel="stylesheet" href="../plugins/font-awesome/css/font-awesome.min.css">
    <link rel="stylesheet" href="../css/style.css">
    <!-- 引入组件库 -->
    <script type="text/javascript" src="../js/jquery.min.js"></script>
    <script src="../js/vue.js"></script>
    <script src="../plugins/elementui/index.js"></script>
    <script src="../js/axios-0.18.0.js"></script>
    <script src="../js/echarts-all.js"></script>
    <script type="text/javascript" src="http://echarts.baidu.com/gallery/vendors/echarts/echarts-all-3.js"></script>
</head>
<body class="hold-transition">
<div id="app">
    <div class="content-header">
        <h1>统计分析<small>每日预约到诊统计</small></h1>
        <el-breadcrumb separator-class="el-icon-arrow-right" class="breadcrumb">
            <el-breadcrumb-item :to="{ path: '/' }">首页</el-breadcrumb-item>
            <el-breadcrumb-item>统计分析</el-breadcrumb-item>
            <el-breadcrumb-item>预约到诊统计</el-breadcrumb-item>
        </el-breadcrumb>
    </div>
    <div class="app-container">
        <div class="box">
            <!--选择日期-->
            <div id="app1">
                <div class="block" style="float:left">
                    <el-date-picker
                            v-model="value2"
                            type="date"
                            placeholder="选择开始日期"
                            format="yyyy 年 MM 月 dd 日"
                            value-format="yyyy-MM-dd">
                    </el-date-picker>
                </div>
                &nbsp;
                &nbsp;
                <div class="block" style="float:left">
                    <el-date-picker
                            v-model="value3"
                            type="date"
                            placeholder="选择结束日期"
                            format="yyyy 年 MM 月 dd 日"
                            value-format="yyyy-MM-dd">
                    </el-date-picker>
                </div>
                <el-button type="primary" class="butT" @click="getVisitCount()" style="float:left">查询</el-button>
            </div>
            <!-- 为 ECharts 准备一个具备大小（宽高）的 DOM -->
            <div id="chart1" style="height:600px;"></div>
        </div>
    </div>
</div>
</body>

<script type="text/javascript">
    var myChart1 = echarts.init(document.getElementById('chart1'));
    new Vue({
        el:'#app1',
        data:{
           value2:'',
            value3:''
        },
        methods:{
            //点击按钮，获取图表
            getVisitCount(){
                // 基于准备好的dom，初始化echarts实例
                var param = {
                    startTime :this.value2,
                    endTime : this.value3
                };

                axios.post("/report/getVisitCount.do",param).then((res) => {
                    myChart1.setOption(
                        {
                            title: {
                                text: '后台数据统计'
                            },
                            tooltip: {
                                trigger: 'axis'
                            },
                            legend: {
                                data: ['每日预约数', '每日到诊数']
                            },
                            grid: {
                                left: '3%',
                                right: '4%',
                                bottom: '3%',
                                containLabel: true
                            },
                            toolbox: {
                                feature: {
                                    saveAsImage: {}
                                }
                            },
                            xAxis: {
                                type: 'category',
                                boundaryGap: false,
                                data: res.data.data.dateList
                                /*['周一', '周二', '周三', '周四', '周五', '周六', '周日']*/
                            },
                            yAxis: {
                                type: 'value'
                            },
                            series: res.data.data.AandVData
                        }
                    );
                });
            }
        }
    });


</script>
</html>
